package com.zx.demo.controller;

import com.zx.mvcframework.annotations.MyController;
import com.zx.mvcframework.annotations.MyRequestMapping;
import com.zx.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @ProjectName: myspring
 * @Package: com.zx.demo.controller
 * @ClassName: UserTestController
 * @Author: 1
 * @Description: 1
 * @Date: 2021/10/4 13:08
 */

@MyController
@MyRequestMapping("/user")
@Security(value = "staff")
public class UserTestController {

    // 员工可以访问
    @MyRequestMapping("/get")
    public void get(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        PrintWriter writer = response.getWriter();
        writer.println("staff");
    }

    // 系统管理员 才可以访问
    @MyRequestMapping("/get2")
    @Security(value = {"xiaohong","xiaoming"})
    public void get2(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        PrintWriter writer = response.getWriter();
        writer.println("get2");
    }

     // 超级管理员 才可以访问
    @MyRequestMapping("/get3")
    @Security(value = {"xiaohong"})
    public void get3(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        PrintWriter writer = response.getWriter();
        writer.println("get3");
    }





}
